<%@ page import="java.sql.*"%>
<%@ include file="dbconn.jsp" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Account Information</title>
<link href="/tros/menuMain.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width=100% bordercolor="#C6D4E1" bgcolor="#C6D4E1">
<tr><th scope="col"><div align="center"><h1 align="center"><font face="Times New Roman">Tros - Online Banking System </font></h1></div></th></tr>
</table>
<div id="overall" align="center">
<div id="dropdwn" align="center">
<ul>
<li><a href='custHome.jsp?value=<%=session.getAttribute( "currentID" )%>'>Home</a>
</li>
</ul>
<ul>
<li><a href='accountInfo.jsp?value=<%=session.getAttribute( "currentID" )%>'>Account</a>
<ul>
<li><a href='viewBalance.jsp?value=<%=session.getAttribute( "currentID" )%>'>View Balance</a></li>
<li><a href='viewTransaction.jsp?value=<%=session.getAttribute( "currentID" )%>'>View Transactions</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href='transferMain.jsp?value=<%=session.getAttribute( "currentID" )%>'>Transfer</a>
<ul>
<li><a href='depositMain.jsp?value=<%=session.getAttribute( "currentID" )%>'>Deposit</a></li>
<li><a href='withdrawal.jsp?value=<%=session.getAttribute( "currentID" )%>'>Withdraw</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href='creditCard.jsp?value=<%=session.getAttribute( "currentID" )%>'>Credit Card</a>
</li>
</ul>
<ul>
<li><a href='paybills.jsp?value=<%=session.getAttribute( "currentID" )%>'>Pay Bills</a>
</li>
</ul>
<ul>
<li><a href='investMain.jsp?value=<%=session.getAttribute( "currentID" )%>'>Investments</a>
<ul>
<li><a href='viewShareInv.jsp?value=<%=session.getAttribute( "currentID" )%>'>Current Shares</a></li>
<li><a href='viewFdInv.jsp?value=<%=session.getAttribute( "currentID" )%>'>Current Fixed Deposit</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href='updatePer.jsp?value=<%=session.getAttribute( "currentID" )%>'>Update Personal Info</a>
<ul>
<li><a href='changePass.jsp?value=<%=session.getAttribute( "currentID" )%>'>Change Password</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href='logout.jsp'>Log Out</a></li>
</ul>
<br class="flow" />
</div>
</div>
&nbsp;
&nbsp;
<legend><b>Balance</b></legend>
<h3 align=center> View Account Balance</h3>
<p align=center>Below is the Detailed Account Information of the Account</p>
<table width=100% align=center cellpadding=5 cellspacing=0 bgcolor="#D5FFD5">
<tr><td>&nbsp;</td></tr>
<%
if(request.getParameter("value").startsWith("sav"))
{
%>
<tr><td align="right"><b> Savings Account NO </b></td><td align="left"><b><%=request.getParameter("value").substring(3)%></b></td></tr>
<%
Statement reqst = connect.createStatement();
ResultSet result =reqst.executeQuery("SELECT * FROM SAVACC WHERE SAVACCNO="+request.getParameter("value").substring(3));
while(result.next())
  {
      String Balance=result.getString("ACC_BALANCE");
      String SaccNo=result.getString("SAVACCNO");   
      String expDate=result.getString("EXPIRY_DATE"); 
      String lname=result.getString("LASTNAME");
%>
<tr><td>&nbsp;</td></tr>
<tr><td align="right"><b> Name of Holder </b></td><td><%=lname%></td></tr>
<tr><td align="right"><b> Currency </b></td><td>    CANADIAN DOLLARS</td></tr>
<tr><td align="right"><b> Current Balance </b></td><td ><%=Balance%> $</td></tr>
<tr><td align="right"><b> Expiry Date </b></td><td><%=expDate%></td></tr>
<tr><td align="right"><b> Interest Rate </b></td><td>3% P.A</td></tr>
<tr><td>&nbsp;</td></tr>
 <%
  }
result.close();

}else if(request.getParameter("value").startsWith("chk"))
{
%>
<tr><td align="right"><b> Checking Account NO </b></td><td align="left"><b><%=request.getParameter("value").substring(3)%></b></td></tr>
<%
Statement reqst = connect.createStatement();
ResultSet result =reqst.executeQuery("SELECT * FROM CHCKACC WHERE CHCKACCNO="+request.getParameter("value").substring(3));
while(result.next())
  {
      String Balance=result.getString("ACC_BALANCE");
      String chaccNo=result.getString("CHCKACCNO");   
      String expDate=result.getString("EXPIRY_DATE"); 
      String lname=result.getString("LASTNAME");
%>
<tr><td>&nbsp;</td></tr>
<tr><td align="right"><b> Name of Holder </b></td><td><%=lname%></td></tr>
<tr><td align="right"><b> Currency </b></td><td>    CANADIAN DOLLARS</td></tr>
<tr><td align="right"><b> Current Balance </b></td><td ><%=Balance%> $</td></tr>
<tr><td align="right"><b> Expiry Date </b></td><td><%=expDate%></td></tr>
<tr><td align="right"><b> Interest Rate </b></td><td>0% P.A</td></tr>
<tr><td>&nbsp;</td></tr>
<%
  }
result.close();	
}else
{
%>
<tr><td align="center"><b><u>Accounts </u></b></td></tr>
<%
Statement reqst = connect.createStatement();
ResultSet result =reqst.executeQuery("SELECT * FROM SAVACC WHERE CUSTOMERID="+request.getParameter("value"));
while(result.next())
  {
      String Balance=result.getString("ACC_BALANCE");
      String SaccNo=result.getString("SAVACCNO");   
      String expDate=result.getString("EXPIRY_DATE"); 
      String lname=result.getString("LASTNAME");
      
%>
 <tr><td>&nbsp;</td></tr>
 <tr><td align="right"><b> Name of Holder </b></td><td><%=lname%></td></tr>
  <tr><td align="right"><b> Account Type </b></td><td> Savings Account</td></tr>
  <tr><td align="right"><b> Account Number </b></td><td> <%=SaccNo%></td></tr>
 <tr><td align="right"><b> Currency </b></td><td>    CANADIAN DOLLARS</td></tr>
  <tr><td align="right"><b> Current Balance </b></td><td ><%=Balance%></td></tr>
 <tr><td align="right"><b> Expiry Date </b></td><td><%=expDate%></td></tr>
  <tr><td align="right"><b> Interest Rate </b></td><td>3% P.A</td></tr>
 <tr><td>&nbsp;</td></tr>
<%
 }
 result.close();
 
 Statement reqst1 = connect.createStatement();
 ResultSet result1 =reqst.executeQuery("SELECT * FROM CHCKACC WHERE CUSTOMERID="+request.getParameter("value"));
 while(result1.next())
   {
       String Balance=result1.getString("ACC_BALANCE");
       String chaccNo=result1.getString("CHCKACCNO");   
       String expDate=result1.getString("EXPIRY_DATE"); 
       String lname=result1.getString("LASTNAME");
 %>
 <tr><td>&nbsp;</td></tr>
 <tr><td align="right"><b> Name of Holder </b></td><td><%=lname%></td></tr>
   <tr><td align="right"><b> Account Type </b></td><td> Chequing Account</td></tr>
  <tr><td align="right"><b> Account Number </b></td><td> <%=chaccNo%></td></tr>
 <tr><td align="right"><b> Currency </b></td><td>    CANADIAN DOLLARS</td></tr>
 <tr><td align="right"><b> Current Balance </b></td><td ><%=Balance%></td></tr>
 <tr><td align="right"><b> Expiry Date </b></td><td><%=expDate%></td></tr>
 <tr><td align="right"><b> Interest Rate </b></td><td>0% P.A</td></tr>
 <tr><td>&nbsp;</td></tr>
 <% 
}
 result1.close();
}
%>
<td colspan="2"><div align="center"><a href='accountInfo.jsp?value=<%=session.getAttribute( "currentID" )%>'>Account</a></div></td>
</table>
</fieldset>
</body>
</html>